<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Errata corrige &#34;Programmare con Python. Guida completa&#34;</title>
    
    <link rel="stylesheet" href="_static/agogo.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    './',
        VERSION:     '',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
    <link rel="top" title="None" href="index.html" /> 
  </head>
  <body>
    <div class="header-wrapper">
      <div class="header">
        <div class="headertitle"><a
          href="errata.html#document-errata">Errata corrige &#34;Programmare con Python. Guida completa&#34;</a></div>
        <div class="rel">
        </div>
       </div>
    </div>

    <div class="content-wrapper">
      <div class="content">
        <div class="document">
            
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="toctree-wrapper compound">
</div>
<div class="section" id="pagina-28">
<h1>Pagina 28<a class="headerlink" href="#pagina-28" title="Permalink to this headline">¶</a></h1>
<p>Segnalato da <strong>Elise Egron</strong></p>
<div class="section" id="originale">
<h2>Originale<a class="headerlink" href="#originale" title="Permalink to this headline">¶</a></h2>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">c</span> <span class="o">=</span> <span class="mi">1</span> <span class="o">+</span> <span class="mi">2j</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">type</span><span class="p">(</span><span class="n">c</span><span class="p">)</span>
<span class="go">&lt;type &#39;complex&#39;&gt;</span>
</pre></div>
</div>
<p>Questo è la rappresentazione che si ha in Python 2.</p>
</div>
<div class="section" id="corretto">
<h2>Corretto<a class="headerlink" href="#corretto" title="Permalink to this headline">¶</a></h2>
<p>Rappresentazione che si ha in Python 3:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">c</span> <span class="o">=</span> <span class="mi">1</span> <span class="o">+</span> <span class="mi">2j</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">type</span><span class="p">(</span><span class="n">c</span><span class="p">)</span>
<span class="go">&lt;class &#39;complex&#39;&gt;</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="pagina-64">
<h1>Pagina 64<a class="headerlink" href="#pagina-64" title="Permalink to this headline">¶</a></h1>
<p>Segnalato da <strong>Gabriele Battaglia</strong></p>
<div class="section" id="id1">
<h2>Originale<a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h2>
<p>C&#8217;e&#8217; un refuso nella frase:</p>
<p><tt class="docutils literal"><span class="pre">Le</span> <span class="pre">istruzioni</span> <span class="pre">hanno</span> <span class="pre">un</span> <span class="pre">nome,</span> <span class="pre">che</span> <span class="pre">deriva</span> <span class="pre">da</span> <span class="pre">quello</span> <span class="pre">dalle</span> <span class="pre">parole</span> <span class="pre">chiave</span>
<span class="pre">utilizzate</span> <span class="pre">al</span> <span class="pre">loro</span> <span class="pre">interno.</span></tt></p>
<p>E&#8217; stato scritto <tt class="docutils literal"><span class="pre">dalle</span> <span class="pre">parole</span> <span class="pre">chiave</span></tt> piuttosto che <tt class="docutils literal"><span class="pre">delle</span> <span class="pre">parole</span> <span class="pre">chiave</span></tt>.</p>
</div>
<div class="section" id="id2">
<h2>Corretto<a class="headerlink" href="#id2" title="Permalink to this headline">¶</a></h2>
<p><tt class="docutils literal"><span class="pre">Le</span> <span class="pre">istruzioni</span> <span class="pre">hanno</span> <span class="pre">un</span> <span class="pre">nome,</span> <span class="pre">che</span> <span class="pre">deriva</span> <span class="pre">da</span> <span class="pre">quello</span> <span class="pre">delle</span> <span class="pre">parole</span> <span class="pre">chiave</span>
<span class="pre">utilizzate</span> <span class="pre">al</span> <span class="pre">loro</span> <span class="pre">interno.</span></tt></p>
</div>
</div>
<div class="section" id="pagina-71">
<h1>Pagina 71<a class="headerlink" href="#pagina-71" title="Permalink to this headline">¶</a></h1>
<p>Segnalato da <strong>Calogero Galipò</strong></p>
<div class="section" id="id3">
<h2>Originale<a class="headerlink" href="#id3" title="Permalink to this headline">¶</a></h2>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span>mv foo foo.py <span class="c"># Rinominiamo il file aggiungendo `.py`. Ora possiamo importarlo</span>
<span class="nv">$ </span>python -c <span class="s2">&quot;import foo&quot;</span>
Ciao, quando è bello Python :<span class="o">)</span>
</pre></div>
</div>
<p>C&#8217;e&#8217; un errore di digitazione: <tt class="docutils literal"><span class="pre">&quot;quando</span> <span class="pre">è</span> <span class="pre">bello&quot;</span></tt> piuttosto che <tt class="docutils literal"><span class="pre">&quot;quanto</span> <span class="pre">è</span> <span class="pre">bello&quot;</span></tt>.</p>
</div>
<div class="section" id="id4">
<h2>Corretto<a class="headerlink" href="#id4" title="Permalink to this headline">¶</a></h2>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span>mv foo foo.py <span class="c"># Rinominiamo il file aggiungendo `.py`. Ora possiamo importarlo</span>
<span class="nv">$ </span>python -c <span class="s2">&quot;import foo&quot;</span>
Ciao, quanto è bello Python :<span class="o">)</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="pagina-124">
<h1>Pagina 124<a class="headerlink" href="#pagina-124" title="Permalink to this headline">¶</a></h1>
<p>Segnalato da <strong>Marco Podda</strong></p>
<div class="section" id="id5">
<h2>Originale<a class="headerlink" href="#id5" title="Permalink to this headline">¶</a></h2>
<p>C&#8217;e&#8217; un errore di digitazione alla 11-esima riga, dove e&#8217; scritto che il valore
da assegnare al codice 011 e&#8217; -3, mentre invece e&#8217; al codice 111
che corrisponde il valore -3. Frase originale:</p>
<p><tt class="docutils literal"><span class="pre">La</span> <span class="pre">piu'</span> <span class="pre">semplice</span> <span class="pre">codifica</span> <span class="pre">dei</span> <span class="pre">numeri</span> <span class="pre">negativi</span> <span class="pre">consiste</span> <span class="pre">nell'assegnare</span> <span class="pre">al</span>
<span class="pre">codice</span> <span class="pre">100</span> <span class="pre">il</span> <span class="pre">valore</span> <span class="pre">decimale</span> <span class="pre">0,</span> <span class="pre">al</span> <span class="pre">codice</span> <span class="pre">101</span> <span class="pre">il</span> <span class="pre">valore</span> <span class="pre">-1,</span> <span class="pre">al</span> <span class="pre">codice</span> <span class="pre">110</span>
<span class="pre">il</span> <span class="pre">valore</span> <span class="pre">-2</span> <span class="pre">e</span> <span class="pre">al</span> <span class="pre">codice</span> <span class="pre">011</span> <span class="pre">il</span> <span class="pre">valore</span> <span class="pre">-3.</span></tt></p>
</div>
<div class="section" id="id6">
<h2>Corretto<a class="headerlink" href="#id6" title="Permalink to this headline">¶</a></h2>
<p><tt class="docutils literal"><span class="pre">La</span> <span class="pre">piu'</span> <span class="pre">semplice</span> <span class="pre">codifica</span> <span class="pre">dei</span> <span class="pre">numeri</span> <span class="pre">negativi</span> <span class="pre">consiste</span> <span class="pre">nell'assegnare</span> <span class="pre">al</span>
<span class="pre">codice</span> <span class="pre">100</span> <span class="pre">il</span> <span class="pre">valore</span> <span class="pre">decimale</span> <span class="pre">0,</span> <span class="pre">al</span> <span class="pre">codice</span> <span class="pre">101</span> <span class="pre">il</span> <span class="pre">valore</span> <span class="pre">-1,</span> <span class="pre">al</span> <span class="pre">codice</span> <span class="pre">110</span>
<span class="pre">il</span> <span class="pre">valore</span> <span class="pre">-2</span> <span class="pre">e</span> <span class="pre">al</span> <span class="pre">codice</span> <span class="pre">111</span> <span class="pre">il</span> <span class="pre">valore</span> <span class="pre">-3.</span></tt></p>
</div>
</div>
<div class="section" id="pagina-132">
<h1>Pagina 132<a class="headerlink" href="#pagina-132" title="Permalink to this headline">¶</a></h1>
<p>Segnalato da <strong>Calogero Galipò</strong></p>
<div class="section" id="id7">
<h2>Originale<a class="headerlink" href="#id7" title="Permalink to this headline">¶</a></h2>
<p>C&#8217;e&#8217; un errore di digitazione nel testo dell&#8217;immagine 2.5.  Al
50-esimo bit e&#8217; stato assegnato l&#8217;indice 51 piuttosto che l&#8217;indice 50:</p>
<a class="reference internal image-reference" href="_images/2.5_originale.jpg"><img alt="Figura 2.5: indice 51 ripetuto erroneamente 2 volte" class="align-center" src="_images/2.5_originale.jpg" style="width: 798.7px; height: 207.9px;" /></a>
</div>
<div class="section" id="id8">
<h2>Corretto<a class="headerlink" href="#id8" title="Permalink to this headline">¶</a></h2>
<a class="reference internal image-reference" href="_images/2.5.jpg"><img alt="Figura 2.5 corretta" class="align-center" src="_images/2.5.jpg" style="width: 798.7px; height: 207.9px;" /></a>
</div>
</div>
<div class="section" id="pagina-135">
<h1>Pagina 135<a class="headerlink" href="#pagina-135" title="Permalink to this headline">¶</a></h1>
<p>Segnalato da <strong>Calogero Galipò</strong></p>
<div class="section" id="id9">
<h2>Originale<a class="headerlink" href="#id9" title="Permalink to this headline">¶</a></h2>
<p>C&#8217;e&#8217; un errore di digitazione sia nell&#8217;immagine 2.8 sia nell&#8217;immagine 2.9.  Al
50-esimo bit e&#8217; stato assegnato l&#8217;indice 51 piuttosto che l&#8217;indice 50:</p>
<a class="reference internal image-reference" href="_images/2.9_originale.jpg"><img alt="Figura 2.9: indice 51 ripetuto erroneamente 2 volte" class="align-center" src="_images/2.9_originale.jpg" style="width: 702.1px; height: 214.2px;" /></a>
<p>L&#8217;errore nell&#8217;immagine 2.8 e&#8217; analogo a quello dell&#8217;immagine 2.9.</p>
</div>
<div class="section" id="id10">
<h2>Corretto<a class="headerlink" href="#id10" title="Permalink to this headline">¶</a></h2>
<a class="reference internal image-reference" href="_images/2.9.jpg"><img alt="Figura 2.9 corretta" class="align-center" src="_images/2.9.jpg" style="width: 702.1px; height: 214.2px;" /></a>
</div>
</div>
<div class="section" id="pagina-148">
<h1>Pagina 148<a class="headerlink" href="#pagina-148" title="Permalink to this headline">¶</a></h1>
<p>Segnalato da <strong>Gollum1</strong></p>
<div class="section" id="id11">
<h2>Originale<a class="headerlink" href="#id11" title="Permalink to this headline">¶</a></h2>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="nb">any</span><span class="p">([])</span> <span class="c"># Restituisce True se l&#39;oggetto iterabile e&#39; vuoto</span>
</pre></div>
</div>
<p>La funzione a cui si fa riferimento e&#8217; <tt class="docutils literal"><span class="pre">all()</span></tt> non <tt class="docutils literal"><span class="pre">any()</span></tt>. Inoltre manca il risultato.</p>
</div>
<div class="section" id="id12">
<h2>Corretto<a class="headerlink" href="#id12" title="Permalink to this headline">¶</a></h2>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="nb">all</span><span class="p">([])</span> <span class="c"># Restituisce True se l&#39;oggetto iterabile e&#39; vuoto</span>
<span class="go">True</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="pagina-151">
<h1>Pagina 151<a class="headerlink" href="#pagina-151" title="Permalink to this headline">¶</a></h1>
<p>Segnalato da <strong>Gollum1</strong></p>
<div class="section" id="id13">
<h2>Originale<a class="headerlink" href="#id13" title="Permalink to this headline">¶</a></h2>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="nb">sorted</span><span class="p">([(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">),</span> <span class="s">&#39;python&#39;</span><span class="p">,</span> <span class="p">{</span><span class="s">&#39;quattro&#39;</span><span class="p">:</span> <span class="mi">4</span><span class="p">,</span> <span class="s">&#39;cinque&#39;</span><span class="p">:</span> <span class="mi">5</span><span class="p">,</span> <span class="s">&#39;sei&#39;</span><span class="p">:</span> <span class="mi">6</span><span class="p">,</span> <span class="s">&#39;otto&#39;</span><span class="p">:</span> <span class="mi">8</span><span class="p">}],</span>
<span class="gp">... </span><span class="n">key</span><span class="o">=</span><span class="nb">len</span><span class="p">,</span> <span class="n">reverse</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
<span class="go">[&#39;python&#39;, {&#39;cinque&#39;: 5, &#39;quattro&#39;: 4, &#39;otto&#39;: 8, &#39;sei&#39;: 6}, (1, 2, 3)]</span>
<span class="go">[&#39;python&#39;, {&#39;sei&#39;: 6, &#39;cinque&#39;: 5, &#39;otto&#39;: 8, &#39;quattro&#39;: 4}, (1, 2, 3)]}}}</span>
</pre></div>
</div>
<p>Sono stati riportati due output piuttosto che uno.</p>
</div>
<div class="section" id="id14">
<h2>Corretto<a class="headerlink" href="#id14" title="Permalink to this headline">¶</a></h2>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="nb">sorted</span><span class="p">([(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">),</span> <span class="s">&#39;python&#39;</span><span class="p">,</span> <span class="p">{</span><span class="s">&#39;quattro&#39;</span><span class="p">:</span> <span class="mi">4</span><span class="p">,</span> <span class="s">&#39;cinque&#39;</span><span class="p">:</span> <span class="mi">5</span><span class="p">,</span> <span class="s">&#39;sei&#39;</span><span class="p">:</span> <span class="mi">6</span><span class="p">,</span> <span class="s">&#39;otto&#39;</span><span class="p">:</span> <span class="mi">8</span><span class="p">}],</span>
<span class="gp">... </span><span class="n">key</span><span class="o">=</span><span class="nb">len</span><span class="p">,</span> <span class="n">reverse</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
<span class="go">[&#39;python&#39;, {&#39;sei&#39;: 6, &#39;cinque&#39;: 5, &#39;otto&#39;: 8, &#39;quattro&#39;: 4}, (1, 2, 3)]}}}</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="pagina-173">
<h1>Pagina 173<a class="headerlink" href="#pagina-173" title="Permalink to this headline">¶</a></h1>
<p>Segnalato da <strong>Gollum1</strong></p>
<div class="section" id="id15">
<h2>Originale<a class="headerlink" href="#id15" title="Permalink to this headline">¶</a></h2>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">s</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span> <span class="c"># Dal primo elemento sino all&#39;ultimo (incluso)</span>
</pre></div>
</div>
<p>Non dal primo elemento, ma dal secondo (quello con indice 1)</p>
</div>
<div class="section" id="id16">
<h2>Corretto<a class="headerlink" href="#id16" title="Permalink to this headline">¶</a></h2>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">s</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span> <span class="c"># Dall&#39;elemento di indice 1 sino all&#39;ultimo (incluso)</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="pagina-200">
<h1>Pagina 200<a class="headerlink" href="#pagina-200" title="Permalink to this headline">¶</a></h1>
<p>Segnalato da <strong>Calogero Galipò</strong></p>
<div class="section" id="id17">
<h2>Originale<a class="headerlink" href="#id17" title="Permalink to this headline">¶</a></h2>
<p>C&#8217;e&#8217; un errore di digitazione (<tt class="docutils literal"><span class="pre">'atgrs'</span></tt> piuttosto che <tt class="docutils literal"><span class="pre">'atbrs'</span></tt>):</p>
<blockquote>
<div>Come possiamo vedere, è stato prima eliminato il carattere s in quanto presente
in <tt class="docutils literal"><span class="pre">'atgrs'</span></tt>. A questo punto da <tt class="docutils literal"><span class="pre">'tringa'</span></tt> viene rimosso il carattere
iniziale <tt class="docutils literal"><span class="pre">t</span></tt>, poiché anch&#8217;esso è presente in <tt class="docutils literal"><span class="pre">'atbrs'</span></tt>.</div></blockquote>
</div>
<div class="section" id="id18">
<h2>Corretto<a class="headerlink" href="#id18" title="Permalink to this headline">¶</a></h2>
<blockquote>
<div>Come possiamo vedere, è stato prima eliminato il carattere s in quanto presente
in <tt class="docutils literal"><span class="pre">'atgrs'</span></tt>. A questo punto da <tt class="docutils literal"><span class="pre">'tringa'</span></tt> viene rimosso il carattere
iniziale <tt class="docutils literal"><span class="pre">t</span></tt>, poiché anch&#8217;esso è presente in <tt class="docutils literal"><span class="pre">'atgrs'</span></tt>.</div></blockquote>
</div>
</div>
<div class="section" id="pagina-218">
<h1>Pagina 218<a class="headerlink" href="#pagina-218" title="Permalink to this headline">¶</a></h1>
<p>Segnalato da <strong>Gollum1</strong></p>
<div class="section" id="id19">
<h2>Originale<a class="headerlink" href="#id19" title="Permalink to this headline">¶</a></h2>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span> <span class="c"># Indice della prima occorrenza di 2</span>
<span class="go">2</span>
</pre></div>
</div>
<p>Errore nel commento: restituisce l&#8217;indice della prima occorrenza di 3, non di 2.</p>
</div>
<div class="section" id="id20">
<h2>Corretto<a class="headerlink" href="#id20" title="Permalink to this headline">¶</a></h2>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span> <span class="c"># Indice della prima occorrenza di 3</span>
<span class="go">2</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="pagina-224">
<h1>Pagina 224<a class="headerlink" href="#pagina-224" title="Permalink to this headline">¶</a></h1>
<p>Segnalato da <strong>Cosimo Damiano Prete</strong></p>
<div class="section" id="id21">
<h2>Originale<a class="headerlink" href="#id21" title="Permalink to this headline">¶</a></h2>
<p>Potremmo risolvere il problema con
<tt class="docutils literal"><span class="pre">print(int(lines[args.index]))</span></tt>, ma esiste una soluzione migliore.
C&#8217;è un refuso, perché è <tt class="docutils literal"><span class="pre">args.index</span></tt> che deve essere convertito in intero.</p>
</div>
<div class="section" id="id22">
<h2>Corretto<a class="headerlink" href="#id22" title="Permalink to this headline">¶</a></h2>
<p>Potremmo risolvere il problema con
<tt class="docutils literal"><span class="pre">print(lines[int(args.index)])</span></tt>, ma esiste una soluzione migliore.</p>
</div>
</div>
<div class="section" id="pagina-228">
<h1>Pagina 228<a class="headerlink" href="#pagina-228" title="Permalink to this headline">¶</a></h1>
<p>Segnalato da <strong>Gollum1</strong></p>
<div class="section" id="id23">
<h2>Originale<a class="headerlink" href="#id23" title="Permalink to this headline">¶</a></h2>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span>python argpar11.py
usage: argpar11.py <span class="o">[</span>-h<span class="o">]</span> -f FILE -i INDEX
argpar11.py: error: the following arguments are required: -f/--file, -i/--index
</pre></div>
</div>
<p>Errore: lo switch <tt class="docutils literal"><span class="pre">index</span></tt> non e&#8217; obbligatorio.</p>
</div>
<div class="section" id="id24">
<h2>Corretto<a class="headerlink" href="#id24" title="Permalink to this headline">¶</a></h2>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span>python argpar11.py
usage: argpar11.py <span class="o">[</span>-h<span class="o">]</span> -f FILE <span class="o">[</span>-i INDEX<span class="o">]</span>
argpar11.py: error: the following arguments are required: -f/--file
</pre></div>
</div>
</div>
</div>
<div class="section" id="pagina-423">
<h1>Pagina 423<a class="headerlink" href="#pagina-423" title="Permalink to this headline">¶</a></h1>
<p>Segnalato da <strong>Davide Bragato</strong></p>
<div class="section" id="id25">
<h2>Originale<a class="headerlink" href="#id25" title="Permalink to this headline">¶</a></h2>
<p>Per fare ciò dobbiamo definire <tt class="docutils literal"><span class="pre">PlaneShape</span></tt> nel seguente modo:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="k">class</span> <span class="nc">PlaneShape</span><span class="p">(</span><span class="n">metaclass</span><span class="o">=</span><span class="n">ABCMeta</span><span class="p">):</span>
<span class="gp">... </span>    <span class="sd">&quot;&quot;&quot;Figura geometrica piana&quot;&quot;&quot;</span>
<span class="gp">...</span>
</pre></div>
</div>
</div>
<div class="section" id="id26">
<h2>Corretto<a class="headerlink" href="#id26" title="Permalink to this headline">¶</a></h2>
<p>Per fare ciò dobbiamo definire <tt class="docutils literal"><span class="pre">PlaneShape</span></tt> nel seguente modo:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">abc</span> <span class="kn">import</span> <span class="n">ABCMeta</span><span class="p">,</span> <span class="n">abstractmethod</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">class</span> <span class="nc">PlaneShape</span><span class="p">(</span><span class="n">metaclass</span><span class="o">=</span><span class="n">ABCMeta</span><span class="p">):</span>
<span class="gp">... </span>    <span class="sd">&quot;&quot;&quot;Figura geometrica piana&quot;&quot;&quot;</span>
<span class="gp">...</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="pagina-424">
<h1>Pagina 424<a class="headerlink" href="#pagina-424" title="Permalink to this headline">¶</a></h1>
<p>Segnalato da <strong>Alessandro Ridolfi</strong></p>
<div class="section" id="id27">
<h2>Originale<a class="headerlink" href="#id27" title="Permalink to this headline">¶</a></h2>
<p>Per due volte ad inizio pagina e&#8217; stato scritto:</p>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">metodo</span> <span class="o">=</span> abstractmethod<span class="o">(</span>methodo<span class="o">)</span>.
</pre></div>
</div>
</div>
<div class="section" id="id28">
<h2>Corretto<a class="headerlink" href="#id28" title="Permalink to this headline">¶</a></h2>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">metodo</span> <span class="o">=</span> abstractmethod<span class="o">(</span>metodo<span class="o">)</span>.
</pre></div>
</div>
</div>
</div>
<div class="section" id="pagina-426">
<h1>Pagina 426<a class="headerlink" href="#pagina-426" title="Permalink to this headline">¶</a></h1>
<p>Segnalato da <strong>Alessandro Ridolfi</strong></p>
<div class="section" id="id29">
<h2>Originale<a class="headerlink" href="#id29" title="Permalink to this headline">¶</a></h2>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="k">class</span> <span class="nc">PlaneShape</span><span class="p">(</span><span class="n">metaclass</span><span class="o">=</span><span class="n">ABCMeta</span><span class="p">):</span>
<span class="gp">... </span>    <span class="k">def</span> <span class="nf">area</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="gp">... </span>        <span class="k">pass</span>
<span class="gp">... </span>    <span class="k">print</span><span class="p">(</span><span class="nb">id</span><span class="p">(</span><span class="n">area</span><span class="p">))</span>
<span class="gp">... </span>    <span class="n">area</span> <span class="o">=</span> <span class="n">abstractmethod</span><span class="p">(</span><span class="n">area</span><span class="p">)</span>
<span class="gp">... </span>    <span class="k">print</span><span class="p">(</span><span class="nb">id</span><span class="p">(</span><span class="n">area</span><span class="p">))</span>
<span class="gp">... </span>    <span class="k">def</span> <span class="nf">perimeter</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="gp">... </span>        <span class="k">pass</span>
<span class="gp">... </span>    <span class="k">print</span><span class="p">(</span><span class="nb">id</span><span class="p">(</span><span class="n">perimeter</span><span class="p">))</span>
<span class="gp">... </span>    <span class="n">area</span> <span class="o">=</span> <span class="n">abstractmethod</span><span class="p">(</span><span class="n">area</span><span class="p">)</span>
<span class="gp">... </span>    <span class="k">print</span><span class="p">(</span><span class="nb">id</span><span class="p">(</span><span class="n">perimeter</span><span class="p">))</span>
</pre></div>
</div>
</div>
<div class="section" id="id30">
<h2>Corretto<a class="headerlink" href="#id30" title="Permalink to this headline">¶</a></h2>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="k">class</span> <span class="nc">PlaneShape</span><span class="p">(</span><span class="n">metaclass</span><span class="o">=</span><span class="n">ABCMeta</span><span class="p">):</span>
<span class="gp">... </span>    <span class="k">def</span> <span class="nf">area</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="gp">... </span>        <span class="k">pass</span>
<span class="gp">... </span>    <span class="k">print</span><span class="p">(</span><span class="nb">id</span><span class="p">(</span><span class="n">area</span><span class="p">))</span>
<span class="gp">... </span>    <span class="n">area</span> <span class="o">=</span> <span class="n">abstractmethod</span><span class="p">(</span><span class="n">area</span><span class="p">)</span>
<span class="gp">... </span>    <span class="k">print</span><span class="p">(</span><span class="nb">id</span><span class="p">(</span><span class="n">area</span><span class="p">))</span>
<span class="gp">... </span>    <span class="k">def</span> <span class="nf">perimeter</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="gp">... </span>        <span class="k">pass</span>
<span class="gp">... </span>    <span class="k">print</span><span class="p">(</span><span class="nb">id</span><span class="p">(</span><span class="n">perimeter</span><span class="p">))</span>
<span class="gp">... </span>    <span class="n">perimeter</span> <span class="o">=</span> <span class="n">abstractmethod</span><span class="p">(</span><span class="n">perimeter</span><span class="p">)</span>
<span class="gp">... </span>    <span class="k">print</span><span class="p">(</span><span class="nb">id</span><span class="p">(</span><span class="n">perimeter</span><span class="p">))</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="pagina-448">
<h1>Pagina 448<a class="headerlink" href="#pagina-448" title="Permalink to this headline">¶</a></h1>
<p>Segnalato da <strong>Alessandro Ridolfi</strong></p>
<div class="section" id="id31">
<h2>Originale<a class="headerlink" href="#id31" title="Permalink to this headline">¶</a></h2>
<p>Cut-and-paste programming</p>
</div>
<div class="section" id="id32">
<h2>Corretto<a class="headerlink" href="#id32" title="Permalink to this headline">¶</a></h2>
<p>Copy-and-paste programming</p>
</div>
</div>


          </div>
        </div>
      </div>
        </div>
        <div class="sidebar">
          <h3>Table Of Contents</h3>
          <ul class="simple">
</ul>

          <h3 style="margin-top: 1.5em;">Search</h3>
          <form class="search" action="search.html" method="get">
            <input type="text" name="q" />
            <input type="submit" value="Go" />
            <input type="hidden" name="check_keywords" value="yes" />
            <input type="hidden" name="area" value="default" />
          </form>
          <p class="searchtip" style="font-size: 90%">
            Enter search terms or a module, class or function name.
          </p>
        </div>
        <div class="clearer"></div>
      </div>
    </div>

    <div class="footer-wrapper">
      <div class="footer">
        <div class="left">
        </div>

        <div class="right">
          
    <div class="footer">
        &copy; Copyright 2014, Marco Buttu.
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
    </div>
        </div>
        <div class="clearer"></div>
      </div>
    </div>

  </body>
</html>